home *** CD-ROM | disk | FTP | other *** search
/ Workbench Add-On / Workbench Add-On - Volume 1.iso / Dev / Oberon / source / amiga / SCSIDisk.mod < prev    next >
Text File  |  1995-06-29  |  5KB  |  139 lines

  1. (**************************************************************************
  2.  
  3.      $RCSfile: SCSIDisk.mod $
  4.   Description: SCSI command definitions
  5.  
  6.    Created by: fjc (Frank Copeland)
  7.     $Revision: 3.8 $
  8.       $Author: fjc $
  9.         $Date: 1995/06/04 23:13:14 $
  10.  
  11.   $VER: scsidisk.h 36.2 (7.11.90)
  12.   Includes Release 40.15
  13.  
  14.   (C) Copyright 1985-1993 Commodore-Amiga, Inc.
  15.       All Rights Reserved
  16.  
  17.   Oberon-A interface Copyright © 1994-1995, Frank Copeland.
  18.   This file is part of the Oberon-A Interface.
  19.   See Oberon-A.doc for conditions of use and distribution.
  20.  
  21. ***************************************************************************)
  22.  
  23. <* STANDARD- *>
  24.  
  25. MODULE [2] SCSIDisk;
  26.  
  27. IMPORT e := Exec, s := Sets;
  28.  
  29.  
  30. (*
  31. **
  32. **      SCSI exec-level device command
  33. **
  34. *)
  35.  
  36.  
  37. (* --------------------------------------------------------------------
  38.  *
  39.  *   SCSI Command
  40.  *      Several Amiga SCSI controller manufacturers are converging on
  41.  *      standard ways to talk to their controllers.  This include
  42.  *      file describes an exec-device command (e.g. for hddisk.device)
  43.  *      that can be used to issue SCSI commands
  44.  *
  45.  *   UNIT NUMBERS
  46.  *      Unit numbers to the OpenDevice call have encoded in them which
  47.  *      SCSI device is being referred to.  The three decimal digits of
  48.  *      the unit number refer to the SCSI Target ID (bus address) in
  49.  *      the 1's digit, the SCSI logical unit (LUN) in the 10's digit,
  50.  *      and the controller board in the 100's digit.
  51.  *
  52.  *      Examples:
  53.  *                0     drive at address 0
  54.  *               12     LUN 1 on multiple drive controller at address 2
  55.  *              104     second controller board, address 4
  56.  *               88     not valid: both logical units and addresses
  57.  *                      range from 0..7.
  58.  *
  59.  *   CAVEATS
  60.  *      Original 2090 code did not support this command.
  61.  *
  62.  *      Commodore 2090/2090A unit numbers are different.  The SCSI
  63.  *      logical unit is the 100's digit, and the SCSI Target ID
  64.  *      is a permuted 1's digit: Target ID 0..6 maps to unit 3..9
  65.  *      (7 is reserved for the controller).
  66.  *
  67.  *          Examples:
  68.  *                3     drive at address 0
  69.  *              109     drive at address 6, logical unit 1
  70.  *                1     not valid: this is not a SCSI unit.  Perhaps
  71.  *                      it's an ST506 unit.
  72.  *
  73.  *      Some controller boards generate a unique name (e.g. 2090A's
  74.  *      iddisk.device) for the second controller board, instead of
  75.  *      implementing the 100's digit.
  76.  *
  77.  *      There are optional restrictions on the alignment, bus
  78.  *      accessability, and size of the data for the data phase.
  79.  *      Be conservative to work with all manufacturer's controllers.
  80.  *
  81.  *------------------------------------------------------------------*)
  82.  
  83. CONST
  84.  
  85.   scsiCmd *      = 28;      (* issue a SCSI command to the unit *)
  86.                             (* ioData points to a SCSICmd *)
  87.                             (* ioLength is SIZE (SCSICmd) *)
  88.                             (* ioActual and ioOffset are not used *)
  89.  
  90. TYPE
  91.  
  92.   SCSICmdPtr * = POINTER TO SCSICmd;
  93.   SCSICmd * = RECORD
  94.     data *        : e.APTR;   (* word aligned data for SCSI Data Phase *)
  95.                               (* (optional) data need not be byte aligned *)
  96.                               (* (optional) data need not be bus accessable *)
  97.     length *      : e.ULONG;  (* even length of Data area *)
  98.                               (* (optional) data can have odd length *)
  99.                               (* (optional) data length can be > 2**24 *)
  100.     actual *      : e.ULONG;  (* actual Data used *)
  101.     command *     : e.APTR;   (* SCSI Command (same options as Data) *)
  102.     cmdLength *   : e.UWORD;  (* length of Command *)
  103.     cmdActual *   : e.UWORD;  (* actual Command used *)
  104.     flags *       : s.SET8;   (* includes intended data direction *)
  105.     status *      : SHORTINT; (* SCSI status of command *)
  106.     senseData *   : e.APTR;   (* sense data: filled if [OLD]AUTOSENSE *)
  107.                               (* is set and Status has CHECK CONDITION *)
  108.                               (* (bit 1) set *)
  109.     senseLength * : e.UWORD;  (* size of SenseData, also bytes to *)
  110.                               (* request w/ AUTOSENSE, must be 4..255 *)
  111.     senseActual * : e.UWORD;  (* amount actually fetched (0 means no sense) *)
  112.   END; (* SCSICmd *)
  113.  
  114. CONST
  115.  
  116. (* ----- scsiFlags -----*)
  117.   write *             = {};      (* intended data direction is out *)
  118.   read *              = 0;       (* intended data direction is in *)
  119.   readWrite *         = 0;       (* (the bit to test) *)
  120.   noSense *           = {};      (* no automatic request sense *)
  121.   autoSense *         = 1;       (* do standard extended request sense *)
  122.                                  (* on check condition *)
  123.   oldAutoSense *      = 2;       (* do 4 byte non-extended request *)
  124.                                  (* sense on check condition *)
  125.  
  126. (* ----- SCSI ioError values -----*)
  127.   selfUnit *          = 40;      (* cannot issue SCSI command to self *)
  128.   dma *               = 41;      (* DMA error *)
  129.   phase *             = 42;      (* illegal or unexpected SCSI phase *)
  130.   parity *            = 43;      (* SCSI parity error *)
  131.   selTimeout *        = 44;      (* Select timed out *)
  132.   badStatus *         = 45;      (* status and/or sense error *)
  133.  
  134. (* ----- OpenDevice ioError values -----*)
  135.   noBoard *           = 50;      (* Open failed for non-existant board *)
  136.  
  137.  
  138. END SCSIDisk.
  139.